# -*- coding: utf- -*-
import io 
import os
import sys
#import pygame
from io import StringIO 
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw

inTxt=sys.argv[1]
outJpg=sys.argv[2]
fontSize=48
if len(sys.argv)>=4:
    fontSize=int(sys.argv[3])

if (len(inTxt) < 6):
    print("inTxt eror,return 1\n")
    sys.exit(1)
if (len(outJpg) < 6):
    sys.exit(2)
    print("outJpg eror,return 1\n")

#width=720
#height=1280
#im=Image.new('RGB',(width,height),(174,196,184))
im=Image.open('bg.jpeg')
dr=ImageDraw.Draw(im)
font = ImageFont.truetype('/System/Library/Fonts/PingFang.ttc', fontSize)
dr.text((20,100),inTxt,font=font,fill='#663366')
#im.show()
im.save(outJpg)
sys.exit(0)
